<html>
<head>
<title>管理系统</title>
<meta http-equiv=Content-Type content=text/html;charset=utf-8>
<#include "../inc/commonJs.html">
<script type="text/JavaScript">
	var grid;
	var grid1;
	var grid2;
	var grid3;
	$(function() {
		 //分类管理表格  
 		 grid = $('#mydocgrid').datagrid({
         url:'kqwccheck.do?flag=0',  
         loadMsg:'数据加载中请稍后……',  
         pagination: true,  
         rownumbers: true,
         pageSize: [${syscfg.pageSize!10}],
         pageList: [${syscfg.pageList!10}],
         striped: true,  
         singleSelect : true,  
         columns:[[  
                   {field:'odatetime',title: '申请时间',align: 'center',width: '150'},  
                   {field:'applicantname',title: '申请人',align: 'center',width: '100'},  
                   {field:'sdatetime',title: '加班开始时间',align: 'center',width: '150'},
                   {field:'edatetime',title: '加班结束时间',align: 'center',width: '150'},
                   {field:'leadername',title: '审批人',align: 'center',width: '150'},
              ]],
             toolbar : '#mydocgridtoolbar'
     });
     
     grid1 = $('#orgdocgrid').datagrid({
		 width: 'auto',  
         height:'auto',             
         striped: true,  
         singleSelect : true,  
         url:'kqwccheck.do?flag=1',
         loadMsg:'数据加载中请稍后……',  
         pagination: true,  
         rownumbers: true,
         queryParams: {
			zt: '2'
		 },
		 columns:[[  
		             {field:'odatetime',title: '申请时间',align: 'center',width: '150'},  
		             {field:'applicantname',title: '申请人',align: 'center',width: '100'},  
		             {field:'sdatetime',title: '加班开始时间',align: 'center',width: '150'},
		             {field:'edatetime',title: '加班结束时间',align: 'center',width: '150'},
		             {field:'leadername',title: '审批人',align: 'center',width: '150'},
		        ]],
             toolbar : '#orgdocgridtoolbar'
     });  
     
     grid2 = $('#wpgrid').datagrid({
		 width: 'auto',  
         height:'auto',             
         striped: true,  
         singleSelect : true,  
         url:'kqwccheck.do?flag=2',
         loadMsg:'数据加载中请稍后……',  
         pagination: true,  
         rownumbers: true,
         queryParams: {
			zt: '2'
		 },
		 columns:[[  
		             {field:'odatetime',title: '申请时间',align: 'center',width: '150'},  
		             {field:'applicantname',title: '申请人',align: 'center',width: '100'},  
		             {field:'sdatetime',title: '加班开始时间',align: 'center',width: '150'},
		             {field:'edatetime',title: '加班结束时间',align: 'center',width: '150'},
		             {field:'leadername',title: '审批人',align: 'center',width: '150'},
		        ]],
             toolbar : '#wpgridtoolbar'
     }); 
     
   
  })
	function add(gridId) {
		var modalwindow = window.top.modalwindow('${request.contextPath}/xadmin/rskq/kqwcadd.do',
			$('#'+gridId),{    
		    width:650,    
		    height:450,
		    title:'新增外出申请',
		    buttons:[top.btn_save,top.btn_close]   
		});
	};
	
	function edit(gridId) {
		var selected = $('#'+gridId).datagrid('getSelected');
		if(!selected){
			window.top.$.messager.alert('提示',"请选择相关数据进行操作！");
			return;
		}
		var modalwindow =  window.top.modalwindow('${request.contextPath}/xadmin/rskq/kqwcedit.do?id='+selected.id,
			$('#'+gridId),{    
		    width:500,    
		    height:280,
		    modal:true,
		    resizable:true,
		    title:'修改外出申请',
		    buttons:[top.btn_save,top.btn_close]
		});
	};
	
	//工具栏删除
	function del(gridId){
		var selected = $('#'+gridId).datagrid('getSelected');
		if(!selected){
			window.top.$.messager.alert('提示',"请选择相关数据进行操作！");
			return;
		}
		window.top.$.messager.confirm('系统提示', '<br>&nbsp;&nbsp;&nbsp;&nbsp;你确定要删除该信息?', function(r) {
			if (r) {
				$.post("kqwcdel.do", { "id": selected.id},
				   function(data){
				   	$('#'+gridId).datagrid('reload'); 
				   	window.top.$.messager.alert('提示',data);
				   	
				});
			}
		});
	}
	
	function restore(gridId){
		$('#'+gridId+'toolbar input').val('');
		$('#'+gridId).datagrid('reload');
	}
	function dosearch(gridId){
		var params =$('#'+gridId).datagrid('options').queryParams;
		if($('#'+gridId+'name').val()){
			params['odatetime'] = $('#'+gridId+'name').val();
		}
		
		$('#'+gridId).datagrid('reload',params);
	}
</script>
</head>
<body>
<div class="easyui-tabs" data-options="fit:true">
	<div title="待批申请">
		<table id="mydocgrid" data-options="fit:true,border:false"></table>
	</div>
	<div title="以准申请">   
       <table id="orgdocgrid" data-options="fit:true,border:false"></table>
    </div>
    <div title="未准申请">   
       <table id="wpgrid" data-options="fit:true,border:false"></table>
    </div>
</div>   
	<div id="mydocgridtoolbar" style="display: none;">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr >
				<td valign="center">
					&nbsp;&nbsp;申请时间:
					<input  type="text" onClick="calendar.show(this);" id="mydocgridname" name="name" maxlength="30" style="width:150px;">
				</td>
				<td valign="center">	
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="dosearch('mydocgrid');">搜索</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="restore('mydocgrid');">重置</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center" align="left">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="add('mydocgrid');">增加</a>
				</td>
				<td valign="center" align="left">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="edit('mydocgrid')">修改</a>
				</td>
				<td valign="center" align="left">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" onclick="del('mydocgrid')">删除</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
			</tr>
		</table>
	</div>
	<div id="orgdocgridtoolbar" style="display: none;">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr >
				<td valign="center">
					&nbsp;&nbsp;申请时间:
					<input  type="text" onClick="calendar.show(this);" id="orgdocgridname" name="name" maxlength="30" style="width:150px;">
				</td>
				<td valign="center">	
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="dosearch('orgdocgrid');">搜索</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="restore('orgdocgrid');">重置</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
			</tr>
		</table>
	</div>
	<div id="wpgridtoolbar" style="display: none;">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr >
				<td valign="center">
					&nbsp;&nbsp;申请时间:
					<input  type="text" onClick="calendar.show(this);" id="wpgridname" name="name" maxlength="30" style="width:150px;">
				</td>
				<td valign="center">	
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="dosearch('wpgrid');">搜索</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="restore('wpgrid');">重置</a>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
				<td valign="center">
					<div class="datagrid-btn-separator"></div>
				</td>
			</tr>
		</table>
	</div>
</body>
</html>
